<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Travel Planner</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://webapi.amap.com/loader.js"></script>
</head>
<body>
<!-- 登录界面 -->
<div id="login-container" class="container">
    <div class="login-form">
        <div class="login-logo">
            <i class="fas fa-globe-asia"></i>
            <h1>AI Travel Planner</h1>
        </div>
        <div class="form-tabs">
            <button class="tab-btn active" onclick="showTab('login', event)">
                <i class="fas fa-sign-in-alt"></i> 登录
            </button>
            <button class="tab-btn" onclick="showTab('register', event)">
                <i class="fas fa-user-plus"></i> 注册
            </button>
        </div>

        <!-- 登录表单 -->
        <div id="login-tab" class="tab-content active">
            <form id="login-form">
                <div class="form-group">
                    <i class="fas fa-user-circle"></i>
                    <input type="text" id="login-userId" placeholder="账号" required>
                </div>
                <div class="form-group">
                    <i class="fas fa-lock"></i>
                    <input type="password" id="login-password" placeholder="密码" required>
                </div>
                <button type="submit" class="btn-primary">
                    <i class="fas fa-arrow-right"></i> 登录
                </button>
            </form>
        </div>

        <!-- 注册表单 -->
        <div id="register-tab" class="tab-content">
            <form id="register-form">
                <div class="form-group">
                    <i class="fas fa-id-card"></i>
                    <input type="text" id="register-userName" placeholder="用户名" required>
                </div>
                <div class="form-group">
                    <i class="fas fa-user-circle"></i>
                    <input type="text" id="register-userId" placeholder="账号" required>
                </div>
                <div class="form-group">
                    <i class="fas fa-lock"></i>
                    <input type="password" id="register-password" placeholder="密码" required>
                </div>
                <button type="submit" class="btn-primary">
                    <i class="fas fa-user-plus"></i> 注册
                </button>
            </form>
        </div>
    </div>
</div>

<!-- 主界面 -->
<div id="main-container" class="container hidden">
    <!-- 顶部导航栏 -->
    <header class="header">
        <div class="logo">
            <i class="fas fa-globe-asia"></i>
            <span>AI Travel Planner</span>
        </div>
        <div class="user-info">
            <i class="fas fa-user-avatar"></i>
            <span id="user-name">用户</span>
            <span id="user-id" class="user-id">(账号)</span>
        </div>

        <!-- 功能按钮区域 -->
        <div class="function-buttons">
            <div class="voice-btn-container">
                <button id="voice-plan-btn" class="voice-btn">
                    <div class="btn-icon">🎤</div>
                    <div class="btn-text-wrapper">
                        <div class="btn-text">智能行程规划</div>
                        <div class="voice-indicator">按住说话</div>
                    </div>
                </button>
                <button id="voice-budget-btn" class="voice-btn">
                    <div class="btn-icon">🎤</div>
                    <div class="btn-text-wrapper">
                        <div class="btn-text">费用预算分析</div>
                        <div class="voice-indicator">按住说话</div>
                    </div>
                </button>
            </div>
            <button id="logout-btn" class="btn-secondary">
                <i class="fas fa-sign-out-alt"></i> 退出
            </button>
        </div>
    </header>

    <!-- 主要内容区域 -->
    <div class="main-content">
        <!-- 左侧导航栏 -->
        <nav class="sidebar">
            <ul class="nav-menu">
                <li><a href="#" class="nav-item active" data-section="travel-plans">
                    <i class="fas fa-route"></i> 智能行程规划
                </a></li>
                <li><a href="#" class="nav-item" data-section="budget-analysis">
                    <i class="fas fa-coins"></i> 费用预算分析
                </a></li>
                <li><a href="#" class="nav-item" data-section="amap">
                    <i class="fas fa-map-marker-alt"></i> 高德地图
                </a></li>
                <li><a href="#" class="nav-item" data-section="universal-assistant">
                    <i class="fas fa-robot"></i> 万能助手
                </a></li>
            </ul>
        </nav>

        <!-- 右侧内容区域 -->
        <main class="content-area">
            <!-- 旅行计划模块 -->
            <section id="travel-plans" class="content-section active">
                <div class="section-header">
                    <h2><i class="fas fa-route"></i> 智能行程规划</h2>
                    <button id="refresh-travel-plans" class="btn-secondary">
                        <i class="fas fa-sync-alt"></i> 刷新
                    </button>
                </div>
                <div id="travel-plans-list" class="list-container">
                    <!-- 旅行计划列表将在这里动态加载 -->
                    <div class="empty-state">
                        <i class="fas fa-map-signs icon"></i>
                        <h3>暂无行程规划</h3>
                        <p>点击语音按钮创建智能行程，或手动添加计划</p>
                    </div>
                </div>
            </section>

            <!-- 费用预算分析模块 -->
            <section id="budget-analysis" class="content-section">
                <div class="section-header">
                    <h2><i class="fas fa-coins"></i> 费用预算分析</h2>
                    <button id="refresh-budget-analysis" class="btn-secondary">
                        <i class="fas fa-sync-alt"></i> 刷新
                    </button>
                </div>
                <div id="budget-analysis-list" class="list-container">
                    <!-- 费用预算分析列表将在这里动态加载 -->
                    <div class="empty-state">
                        <i class="fas fa-wallet icon"></i>
                        <h3>暂无预算分析</h3>
                        <p>创建旅行计划后自动生成费用预算分析</p>
                    </div>
                </div>
            </section>

            <!-- 高德地图模块 -->
            <section id="amap" class="content-section">
                <div class="section-header">
                    <h2><i class="fas fa-map-marker-alt"></i> 高德地图</h2>
                    <div class="map-controls">
                        <button id="locate-me" class="btn-primary">
                            <i class="fas fa-location-arrow"></i> 定位我的位置
                        </button>
                        <button id="route-planning-btn" class="btn-primary">
                            <i class="fas fa-route"></i> 路线规划
                        </button>
                        <button id="reset-map" class="btn-secondary">
                            <i class="fas fa-redo"></i> 重置地图
                        </button>
                    </div>
                </div>

                <!-- 路线规划面板 -->
                <div id="route-planning-panel" class="route-panel hidden">
                    <div class="route-header">
                        <h3><i class="fas fa-route"></i> 路线规划</h3>
                        <button id="close-route-panel" class="close-btn">&times;</button>
                    </div>
                    <div class="route-form">
                        <div class="form-group">
                            <label for="start-point"><i class="fas fa-map-marker-alt"></i> 起点：</label>
                            <input type="text" id="start-point" placeholder="输入起点地址">
                        </div>
                        <div class="form-group">
                            <label for="end-point"><i class="fas fa-flag"></i> 终点：</label>
                            <input type="text" id="end-point" placeholder="输入终点地址">
                        </div>
                        <button id="search-route" class="btn-primary">
                            <i class="fas fa-search"></i> 搜索路线
                        </button>
                        <button id="clear-route" class="btn-secondary">
                            <i class="fas fa-times"></i> 清除路线
                        </button>
                    </div>
                    <div id="route-results" class="route-results">
                        <div id="route-panel" class="route-panel-content">
                            <!-- 路线规划结果将在这里显示 -->
                        </div>
                    </div>
                </div>

                <div id="map-container" class="map-container">
                    <!-- 高德地图将在这里显示 -->
                    <div id="map-loading" class="map-loading">
                        <div class="loading-spinner"></div>
                        <p>地图加载中...</p>
                    </div>
                    <div id="map" style="width: 100%; height: 100%;"></div>
                </div>
                <div id="location-info" class="location-info">
                    <p><i class="fas fa-map-pin"></i> 当前位置：<span id="current-location" class="location-default">未获取位置信息</span></p>
                </div>
            </section>

            <!-- 万能助手模块 -->
            <section id="universal-assistant" class="content-section">
                <div class="section-header">
                    <h2><i class="fas fa-robot"></i> 万能助手</h2>
                </div>
                <div class="assistant-container">
                    <div class="assistant-welcome">
                        <i class="fas fa-comments"></i>
                        <h3>我是你的旅行万能助手，有什么可以帮你？</h3>
                        <p>可以问我旅行攻略、景点推荐、天气查询等问题</p>
                    </div>

                    <div class="assistant-input-area">
                        <textarea id="question-input" placeholder="例如：推荐三亚3天2晚旅行攻略..." rows="4"></textarea>
                        <button id="send-question" class="btn-primary">
                            <i class="fas fa-paper-plane"></i> 发送
                        </button>
                    </div>

                    <div id="assistant-loading" class="assistant-loading hidden">
                        <div class="loading-spinner"></div>
                        <p>正在分析您的问题，请稍候...</p>
                    </div>

                    <div id="assistant-response" class="assistant-response hidden">
                        <div class="response-header">
                            <h4><i class="fas fa-reply"></i> 助手回复</h4>
                            <button id="clear-response" class="btn-secondary">
                                <i class="fas fa-times"></i> 清除
                            </button>
                        </div>
                        <div id="response-content" class="response-content"></div>
                    </div>

                    <div id="assistant-history" class="assistant-history hidden">
                        <div class="history-header">
                            <h4><i class="fas fa-history"></i> 历史对话</h4>
                            <button id="clear-history" class="btn-secondary">
                                <i class="fas fa-trash"></i> 清除历史
                            </button>
                        </div>
                        <div id="history-list" class="history-list"></div>
                    </div>
                </div>
            </section>
        </main>
    </div>
</div>

<!-- 模态框 -->
<div id="modal" class="modal hidden">
    <div class="modal-content">
        <div class="modal-header">
            <h3 id="modal-title"><i class="fas fa-info-circle"></i> 详情</h3>
            <button id="close-modal" class="close-btn">
                <i class="fas fa-times"></i>
            </button>
        </div>
        <div class="modal-body">
            <div id="modal-content">
                <!-- 模态框内容将在这里动态加载 -->
            </div>
        </div>
    </div>
</div>

<!-- 语音输入模态框 -->
<div id="voice-modal" class="modal hidden">
    <div class="modal-content voice-modal">
        <div class="modal-header">
            <h3 id="voice-modal-title"><i class="fas fa-microphone"></i> 语音输入</h3>
            <button id="close-voice-modal" class="close-btn">
                <i class="fas fa-times"></i>
            </button>
        </div>
        <div class="modal-body">
            <div class="voice-input-area">
                <div id="voice-status" class="voice-status">准备录音...</div>
                <div id="voice-wave" class="voice-wave">
                    <span class="wave-bar"></span>
                    <span class="wave-bar"></span>
                    <span class="wave-bar"></span>
                    <span class="wave-bar"></span>
                    <span class="wave-bar"></span>
                    <span class="wave-bar"></span>
                    <span class="wave-bar"></span>
                </div>
                <div id="voice-text" class="voice-text">请按住录音按钮开始说话...</div>
            </div>
            <div class="voice-actions">
                <button id="start-recording" class="btn-primary">
                    <i class="fas fa-microphone"></i> 开始录音
                </button>
                <button id="stop-recording" class="btn-secondary hidden">
                    <i class="fas fa-stop"></i> 停止录音
                </button>
                <button id="submit-voice" class="btn-primary hidden">
                    <i class="fas fa-check"></i> 提交
                </button>
            </div>
        </div>
    </div>
</div>

<!-- 高德地图API -->
<script src="script.js"></script>
</body>
</html>